// asserts/component/groups/teacher/stu-list-to-select/stu-list.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    stuList: Array
  },

  /**
   * 组件的初始数据
   */
  data: {
    id:'',
    currentActiveIndex: 0
  },

  /**
   * 组件的方法列表
   */
  methods: {
    sideBarClick: function(detail){
      this.setData({
        id: detail.currentTarget.dataset.item.index,
        ["stuList[" + this.data.currentActiveIndex + "].active"]: false,
        currentActiveIndex: detail.currentTarget.dataset.index,
        ["stuList[" + detail.currentTarget.dataset.index + "].active"]: true
      })
    },
    show: function(data) {
      console.log(data);
      var data = data.currentTarget.dataset;
      this.setData({
        ["stuList["+ data.itemidex +"].studentList[" + data.elindex + "].courseShow"]: !data.show
      })
    },
    tapItem: function(e){
      console.log(e.currentTarget.dataset)
      let cs= this.selectAllComponents(".radioSel");
      for(let i=0; i< cs.length; i++){
        if(e.currentTarget.dataset.itemindex == cs[i].dataset.itemindex
          && e.currentTarget.dataset.elindex == cs[i].dataset.elindex){
            cs[i].click();
          }
      }
    },
    chooseChange: function(e) {
      this.triggerEvent("stuChoose",{
        itemindex: e.currentTarget.dataset.itemindex,
        elindex: e.currentTarget.dataset.elindex,
        value: e.detail.value
      },{})
    }
  }
})
